﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Application.Service
{
    /// <summary>
    /// 聚合服务
    /// </summary>
    public abstract class JuheService
    {
        /// <summary>
        /// 应用Key名称
        /// </summary>
        protected abstract string AppKeyName { get; }

        /// <summary>
        /// 获取Key
        /// </summary>
        protected string AppKey
        {
            get
            {
                return System.Configuration.ConfigurationManager.AppSettings[AppKeyName];
            }
        }

        protected object GetDictionaryValueOrDefault(IDictionary<string, object> dic, string key, object defalutValue)
        {
            object value;
            if (dic.TryGetValue(key, out value))
            {
                if (value == null)
                {
                    return defalutValue;
                }
                return value;
            }
            return defalutValue;
        }
    }
}
